﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;

namespace Wimat.Collections.Example
{
    public class ApplicationMV
    {
        #region Lazy
        private LazyCurrentCollectionView _Lazy;
        public LazyCurrentCollectionView Lazy
        {
            get
            {
                if (_Lazy == null)
                {
                    var items = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
                    _Lazy = new LazyCurrentCollectionView(items);
                }
                return _Lazy;
            }
        }
        #endregion

        #region Randomized
        private RandomizedCollectionView _Randomized;
        public RandomizedCollectionView Randomized
        {
            get
            {
                if (_Randomized == null)
                {
                    var items = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
                    _Randomized = new RandomizedCollectionView(items);
                }
                return _Randomized;
            }
        }
        #endregion

        #region Split
        private SplitCollectionView<int, string> _Split;
        public SplitCollectionView<int, string> Split
        {
            get
            {
                if (_Split == null)
                {
                    var items = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
                    _Split = new SplitCollectionView<int, string>()
                    {
                        Domain = new ReadOnlyObservableCollection<int>(new ObservableCollection<int>(items)),
                        SourceToResult = (sourceItem) => string.Format("String - {0}", sourceItem),
                    };
                }
                return _Split;
            }
        }
        #endregion
    }
}
